3.1096 \(\int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^3} \, dx\)

Optimal. Leaf size=125 \[ \frac {2 i a^2}{f (c-i d)^2 (c+d \tan (e+f x))}+\frac {a^2 (-d+i c)}{2 d f (d+i c) (c+d \tan (e+f x))^2}-\frac {2 a^2 \log (c \cos (e+f x)+d \sin (e+f x))}{f (d+i c)^3}+\frac {2 a^2 x}{(c-i d)^3} \]

[Out]

2*a^2*x/(c-I*d)^3-2*a^2*ln(c*cos(f*x+e)+d*sin(f*x+e))/(I*c+d)^3/f+1/2*a^2*(I*c-d)/d/(I*c+d)/f/(c+d*tan(f*x+e))
^2+2*I*a^2/(c-I*d)^2/f/(c+d*tan(f*x+e))

________________________________________________________________________________________

Rubi [A]  time = 0.27, antiderivative size = 125, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3542, 3529, 3531, 3530} \[ \frac {2 i a^2}{f (c-i d)^2 (c+d \tan (e+f x))}+\frac {a^2 (-d+i c)}{2 d f (d+i c) (c+d \tan (e+f x))^2}-\frac {2 a^2 \log (c \cos (e+f x)+d \sin (e+f x))}{f (d+i c)^3}+\frac {2 a^2 x}{(c-i d)^3} \]

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^2/(c + d*Tan[e + f*x])^3,x]

[Out]

(2*a^2*x)/(c - I*d)^3 - (2*a^2*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/((I*c + d)^3*f) + (a^2*(I*c - d))/(2*d*(I
*c + d)*f*(c + d*Tan[e + f*x])^2) + ((2*I)*a^2)/((c - I*d)^2*f*(c + d*Tan[e + f*x]))

Rule 3529

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^(m + 1))/(f*(m + 1)*(a^2 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3530

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c*Log[Re
moveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]])/(b*f), x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3542

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
((b*c - a*d)^2*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)*(a^2 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Ta
n[e + f*x])^(m + 1)*Simp[a*c^2 + 2*b*c*d - a*d^2 - (b*c^2 - 2*a*c*d - b*d^2)*Tan[e + f*x], x], x], x] /; FreeQ
[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] && NeQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^3} \, dx &=\frac {a^2 (i c-d)}{2 d (i c+d) f (c+d \tan (e+f x))^2}+\frac {\int \frac {2 a^2 (c+i d)+2 a^2 (i c-d) \tan (e+f x)}{(c+d \tan (e+f x))^2} \, dx}{c^2+d^2}\\ &=\frac {a^2 (i c-d)}{2 d (i c+d) f (c+d \tan (e+f x))^2}+\frac {2 i a^2}{(c-i d)^2 f (c+d \tan (e+f x))}+\frac {\int \frac {2 a^2 (c+i d)^2+2 i a^2 (c+i d)^2 \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{\left (c^2+d^2\right )^2}\\ &=\frac {2 a^2 x}{(c-i d)^3}+\frac {a^2 (i c-d)}{2 d (i c+d) f (c+d \tan (e+f x))^2}+\frac {2 i a^2}{(c-i d)^2 f (c+d \tan (e+f x))}-\frac {\left (2 a^2\right ) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{(i c+d)^3}\\ &=\frac {2 a^2 x}{(c-i d)^3}-\frac {2 a^2 \log (c \cos (e+f x)+d \sin (e+f x))}{(i c+d)^3 f}+\frac {a^2 (i c-d)}{2 d (i c+d) f (c+d \tan (e+f x))^2}+\frac {2 i a^2}{(c-i d)^2 f (c+d \tan (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 6.23, size = 317, normalized size = 2.54 \[ \frac {a^2 (\cos (e+f x)+i \sin (e+f x))^2 \left (-\frac {2 (\cos (2 e)-i \sin (2 e)) \tan ^{-1}\left (\frac {\left (d^3-3 c^2 d\right ) \cos (3 e+f x)+c \left (c^2-3 d^2\right ) \sin (3 e+f x)}{c \left (c^2-3 d^2\right ) \cos (3 e+f x)-d \left (d^2-3 c^2\right ) \sin (3 e+f x)}\right )}{f}-\frac {(c-i d) (c+2 i d) (\cos (2 e)-i \sin (2 e)) \sin (f x)}{f (c \cos (e)+d \sin (e)) (c \cos (e+f x)+d \sin (e+f x))}+\frac {d (c-i d) (\cos (2 e)-i \sin (2 e))}{2 f (c \cos (e+f x)+d \sin (e+f x))^2}+\frac {(-\sin (2 e)-i \cos (2 e)) \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )}{f}+4 x (\cos (2 e)-i \sin (2 e))\right )}{(c-i d)^3 (\cos (f x)+i \sin (f x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^2/(c + d*Tan[e + f*x])^3,x]

[Out]

(a^2*(Cos[e + f*x] + I*Sin[e + f*x])^2*((Log[(c*Cos[e + f*x] + d*Sin[e + f*x])^2]*((-I)*Cos[2*e] - Sin[2*e]))/
f + 4*x*(Cos[2*e] - I*Sin[2*e]) - (2*ArcTan[((-3*c^2*d + d^3)*Cos[3*e + f*x] + c*(c^2 - 3*d^2)*Sin[3*e + f*x])
/(c*(c^2 - 3*d^2)*Cos[3*e + f*x] - d*(-3*c^2 + d^2)*Sin[3*e + f*x])]*(Cos[2*e] - I*Sin[2*e]))/f + ((c - I*d)*d
*(Cos[2*e] - I*Sin[2*e]))/(2*f*(c*Cos[e + f*x] + d*Sin[e + f*x])^2) - ((c - I*d)*(c + (2*I)*d)*(Cos[2*e] - I*S
in[2*e])*Sin[f*x])/(f*(c*Cos[e] + d*Sin[e])*(c*Cos[e + f*x] + d*Sin[e + f*x]))))/((c - I*d)^3*(Cos[f*x] + I*Si
n[f*x])^2)

________________________________________________________________________________________

fricas [B]  time = 0.44, size = 311, normalized size = 2.49 \[ \frac {2 \, {\left (a^{2} c^{2} + 3 i \, a^{2} c d - 2 \, a^{2} d^{2} + {\left (a^{2} c^{2} + 2 i \, a^{2} c d + 3 \, a^{2} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2} + {\left (a^{2} c^{2} - 2 i \, a^{2} c d - a^{2} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, {\left (a^{2} c^{2} + a^{2} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (\frac {{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right )\right )}}{{\left (i \, c^{5} + 5 \, c^{4} d - 10 i \, c^{3} d^{2} - 10 \, c^{2} d^{3} + 5 i \, c d^{4} + d^{5}\right )} f e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (2 i \, c^{5} + 6 \, c^{4} d - 4 i \, c^{3} d^{2} + 4 \, c^{2} d^{3} - 6 i \, c d^{4} - 2 \, d^{5}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, c^{5} + c^{4} d + 2 i \, c^{3} d^{2} + 2 \, c^{2} d^{3} + i \, c d^{4} + d^{5}\right )} f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2/(c+d*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

2*(a^2*c^2 + 3*I*a^2*c*d - 2*a^2*d^2 + (a^2*c^2 + 2*I*a^2*c*d + 3*a^2*d^2)*e^(2*I*f*x + 2*I*e) + (a^2*c^2 + 2*
I*a^2*c*d - a^2*d^2 + (a^2*c^2 - 2*I*a^2*c*d - a^2*d^2)*e^(4*I*f*x + 4*I*e) + 2*(a^2*c^2 + a^2*d^2)*e^(2*I*f*x
 + 2*I*e))*log(((I*c + d)*e^(2*I*f*x + 2*I*e) + I*c - d)/(I*c + d)))/((I*c^5 + 5*c^4*d - 10*I*c^3*d^2 - 10*c^2
*d^3 + 5*I*c*d^4 + d^5)*f*e^(4*I*f*x + 4*I*e) + (2*I*c^5 + 6*c^4*d - 4*I*c^3*d^2 + 4*c^2*d^3 - 6*I*c*d^4 - 2*d
^5)*f*e^(2*I*f*x + 2*I*e) + (I*c^5 + c^4*d + 2*I*c^3*d^2 + 2*c^2*d^3 + I*c*d^4 + d^5)*f)

________________________________________________________________________________________

giac [B]  time = 0.94, size = 472, normalized size = 3.78 \[ \frac {2 \, {\left (\frac {a^{2} \log \left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - c\right )}{i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} - d^{3}} - \frac {2 \, a^{2} \log \left (-i \, \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} - d^{3}} + \frac {3 \, a^{2} c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 2 i \, a^{2} c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 10 \, a^{2} c^{3} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 6 i \, a^{2} c^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 2 \, a^{2} c d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 6 \, a^{2} c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 i \, a^{2} c^{3} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 6 \, a^{2} c^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 10 i \, a^{2} c d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 \, a^{2} d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 i \, a^{2} c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 10 \, a^{2} c^{3} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 6 i \, a^{2} c^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 2 \, a^{2} c d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 3 \, a^{2} c^{4}}{{\left (-2 i \, c^{5} - 6 \, c^{4} d + 6 i \, c^{3} d^{2} + 2 \, c^{2} d^{3}\right )} {\left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - c\right )}^{2}}\right )}}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2/(c+d*tan(f*x+e))^3,x, algorithm="giac")

[Out]

2*(a^2*log(c*tan(1/2*f*x + 1/2*e)^2 - 2*d*tan(1/2*f*x + 1/2*e) - c)/(I*c^3 + 3*c^2*d - 3*I*c*d^2 - d^3) - 2*a^
2*log(-I*tan(1/2*f*x + 1/2*e) + 1)/(I*c^3 + 3*c^2*d - 3*I*c*d^2 - d^3) + (3*a^2*c^4*tan(1/2*f*x + 1/2*e)^4 - 2
*I*a^2*c^4*tan(1/2*f*x + 1/2*e)^3 - 10*a^2*c^3*d*tan(1/2*f*x + 1/2*e)^3 - 6*I*a^2*c^2*d^2*tan(1/2*f*x + 1/2*e)
^3 - 2*a^2*c*d^3*tan(1/2*f*x + 1/2*e)^3 - 6*a^2*c^4*tan(1/2*f*x + 1/2*e)^2 + 2*I*a^2*c^3*d*tan(1/2*f*x + 1/2*e
)^2 + 6*a^2*c^2*d^2*tan(1/2*f*x + 1/2*e)^2 + 10*I*a^2*c*d^3*tan(1/2*f*x + 1/2*e)^2 + 2*a^2*d^4*tan(1/2*f*x + 1
/2*e)^2 + 2*I*a^2*c^4*tan(1/2*f*x + 1/2*e) + 10*a^2*c^3*d*tan(1/2*f*x + 1/2*e) + 6*I*a^2*c^2*d^2*tan(1/2*f*x +
 1/2*e) + 2*a^2*c*d^3*tan(1/2*f*x + 1/2*e) + 3*a^2*c^4)/((-2*I*c^5 - 6*c^4*d + 6*I*c^3*d^2 + 2*c^2*d^3)*(c*tan
(1/2*f*x + 1/2*e)^2 - 2*d*tan(1/2*f*x + 1/2*e) - c)^2))/f

________________________________________________________________________________________

maple [B]  time = 0.29, size = 562, normalized size = 4.50 \[ -\frac {3 i a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) c \,d^{2}}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {a^{2} c^{2}}{2 f \left (c^{2}+d^{2}\right ) d \left (c +d \tan \left (f x +e \right )\right )^{2}}-\frac {a^{2} d}{2 f \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )^{2}}-\frac {2 i a^{2} \arctan \left (\tan \left (f x +e \right )\right ) d^{3}}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {2 i a^{2} d^{2}}{f \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}-\frac {4 a^{2} c d}{f \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}+\frac {6 i a^{2} \ln \left (c +d \tan \left (f x +e \right )\right ) c \,d^{2}}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {i a^{2} c}{f \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )^{2}}+\frac {6 a^{2} \ln \left (c +d \tan \left (f x +e \right )\right ) c^{2} d}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {2 a^{2} \ln \left (c +d \tan \left (f x +e \right )\right ) d^{3}}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {i a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) c^{3}}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {6 i a^{2} \arctan \left (\tan \left (f x +e \right )\right ) c^{2} d}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {2 i a^{2} c^{2}}{f \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}-\frac {2 i a^{2} \ln \left (c +d \tan \left (f x +e \right )\right ) c^{3}}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {2 a^{2} \arctan \left (\tan \left (f x +e \right )\right ) c^{3}}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {6 a^{2} \arctan \left (\tan \left (f x +e \right )\right ) c \,d^{2}}{f \left (c^{2}+d^{2}\right )^{3}}-\frac {3 a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) c^{2} d}{f \left (c^{2}+d^{2}\right )^{3}}+\frac {a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) d^{3}}{f \left (c^{2}+d^{2}\right )^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^2/(c+d*tan(f*x+e))^3,x)

[Out]

-3*I/f*a^2/(c^2+d^2)^3*ln(1+tan(f*x+e)^2)*c*d^2+1/2/f*a^2/(c^2+d^2)/d/(c+d*tan(f*x+e))^2*c^2-1/2/f*a^2/(c^2+d^
2)*d/(c+d*tan(f*x+e))^2-2*I/f*a^2/(c^2+d^2)^3*arctan(tan(f*x+e))*d^3-2*I/f*a^2/(c^2+d^2)^2/(c+d*tan(f*x+e))*d^
2-4/f*a^2/(c^2+d^2)^2/(c+d*tan(f*x+e))*c*d+6*I/f*a^2/(c^2+d^2)^3*ln(c+d*tan(f*x+e))*c*d^2+I/f*a^2/(c^2+d^2)/(c
+d*tan(f*x+e))^2*c+6/f*a^2/(c^2+d^2)^3*ln(c+d*tan(f*x+e))*c^2*d-2/f*a^2/(c^2+d^2)^3*ln(c+d*tan(f*x+e))*d^3+I/f
*a^2/(c^2+d^2)^3*ln(1+tan(f*x+e)^2)*c^3+6*I/f*a^2/(c^2+d^2)^3*arctan(tan(f*x+e))*c^2*d+2*I/f*a^2/(c^2+d^2)^2/(
c+d*tan(f*x+e))*c^2-2*I/f*a^2/(c^2+d^2)^3*ln(c+d*tan(f*x+e))*c^3+2/f*a^2/(c^2+d^2)^3*arctan(tan(f*x+e))*c^3-6/
f*a^2/(c^2+d^2)^3*arctan(tan(f*x+e))*c*d^2-3/f*a^2/(c^2+d^2)^3*ln(1+tan(f*x+e)^2)*c^2*d+1/f*a^2/(c^2+d^2)^3*ln
(1+tan(f*x+e)^2)*d^3

________________________________________________________________________________________

maxima [B]  time = 0.44, size = 381, normalized size = 3.05 \[ \frac {\frac {2 \, {\left (2 \, a^{2} c^{3} + 6 i \, a^{2} c^{2} d - 6 \, a^{2} c d^{2} - 2 i \, a^{2} d^{3}\right )} {\left (f x + e\right )}}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {2 \, {\left (-2 i \, a^{2} c^{3} + 6 \, a^{2} c^{2} d + 6 i \, a^{2} c d^{2} - 2 \, a^{2} d^{3}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {{\left (2 i \, a^{2} c^{3} - 6 \, a^{2} c^{2} d - 6 i \, a^{2} c d^{2} + 2 \, a^{2} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {a^{2} c^{4} + 6 i \, a^{2} c^{3} d - 8 \, a^{2} c^{2} d^{2} - 2 i \, a^{2} c d^{3} - a^{2} d^{4} - {\left (-4 i \, a^{2} c^{2} d^{2} + 8 \, a^{2} c d^{3} + 4 i \, a^{2} d^{4}\right )} \tan \left (f x + e\right )}{c^{6} d + 2 \, c^{4} d^{3} + c^{2} d^{5} + {\left (c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (c^{5} d^{2} + 2 \, c^{3} d^{4} + c d^{6}\right )} \tan \left (f x + e\right )}}{2 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2/(c+d*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

1/2*(2*(2*a^2*c^3 + 6*I*a^2*c^2*d - 6*a^2*c*d^2 - 2*I*a^2*d^3)*(f*x + e)/(c^6 + 3*c^4*d^2 + 3*c^2*d^4 + d^6) +
 2*(-2*I*a^2*c^3 + 6*a^2*c^2*d + 6*I*a^2*c*d^2 - 2*a^2*d^3)*log(d*tan(f*x + e) + c)/(c^6 + 3*c^4*d^2 + 3*c^2*d
^4 + d^6) + (2*I*a^2*c^3 - 6*a^2*c^2*d - 6*I*a^2*c*d^2 + 2*a^2*d^3)*log(tan(f*x + e)^2 + 1)/(c^6 + 3*c^4*d^2 +
 3*c^2*d^4 + d^6) + (a^2*c^4 + 6*I*a^2*c^3*d - 8*a^2*c^2*d^2 - 2*I*a^2*c*d^3 - a^2*d^4 - (-4*I*a^2*c^2*d^2 + 8
*a^2*c*d^3 + 4*I*a^2*d^4)*tan(f*x + e))/(c^6*d + 2*c^4*d^3 + c^2*d^5 + (c^4*d^3 + 2*c^2*d^5 + d^7)*tan(f*x + e
)^2 + 2*(c^5*d^2 + 2*c^3*d^4 + c*d^6)*tan(f*x + e)))/f

________________________________________________________________________________________

mupad [B]  time = 5.51, size = 297, normalized size = 2.38 \[ -\frac {\frac {a^2\,c^2+a^2\,c\,d\,4{}\mathrm {i}+a^2\,d^2}{2\,d^3\,\left (-c^2+c\,d\,2{}\mathrm {i}+d^2\right )}+\frac {a^2\,\mathrm {tan}\left (e+f\,x\right )\,2{}\mathrm {i}}{d\,\left (-c^2+c\,d\,2{}\mathrm {i}+d^2\right )}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2+\frac {c^2}{d^2}+\frac {2\,c\,\mathrm {tan}\left (e+f\,x\right )}{d}\right )}+\frac {a^2\,\mathrm {atan}\left (\frac {c^3-c^2\,d\,1{}\mathrm {i}+c\,d^2-d^3\,1{}\mathrm {i}}{{\left (c-d\,1{}\mathrm {i}\right )}^2\,\left (d+c\,1{}\mathrm {i}\right )}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (2\,c^8\,d^2+8\,c^6\,d^4+12\,c^4\,d^6+8\,c^2\,d^8+2\,d^{10}\right )\,1{}\mathrm {i}}{{\left (c-d\,1{}\mathrm {i}\right )}^2\,\left (d+c\,1{}\mathrm {i}\right )\,\left (-c^6\,d\,1{}\mathrm {i}+2\,c^5\,d^2-c^4\,d^3\,1{}\mathrm {i}+4\,c^3\,d^4+c^2\,d^5\,1{}\mathrm {i}+2\,c\,d^6+d^7\,1{}\mathrm {i}\right )}\right )\,4{}\mathrm {i}}{f\,{\left (c-d\,1{}\mathrm {i}\right )}^2\,\left (d+c\,1{}\mathrm {i}\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*tan(e + f*x)*1i)^2/(c + d*tan(e + f*x))^3,x)

[Out]

(a^2*atan((c*d^2 - c^2*d*1i + c^3 - d^3*1i)/((c - d*1i)^2*(c*1i + d)) - (tan(e + f*x)*(2*d^10 + 8*c^2*d^8 + 12
*c^4*d^6 + 8*c^6*d^4 + 2*c^8*d^2)*1i)/((c - d*1i)^2*(c*1i + d)*(2*c*d^6 - c^6*d*1i + d^7*1i + c^2*d^5*1i + 4*c
^3*d^4 - c^4*d^3*1i + 2*c^5*d^2)))*4i)/(f*(c - d*1i)^2*(c*1i + d)) - ((a^2*c^2 + a^2*d^2 + a^2*c*d*4i)/(2*d^3*
(c*d*2i - c^2 + d^2)) + (a^2*tan(e + f*x)*2i)/(d*(c*d*2i - c^2 + d^2)))/(f*(tan(e + f*x)^2 + c^2/d^2 + (2*c*ta
n(e + f*x))/d))

________________________________________________________________________________________

sympy [B]  time = 8.21, size = 389, normalized size = 3.11 \[ - \frac {2 i a^{2} \log {\left (\frac {- i c + d}{- i c e^{2 i e} - d e^{2 i e}} + e^{2 i f x} \right )}}{f \left (c - i d\right )^{3}} + \frac {2 a^{2} c^{2} + 6 i a^{2} c d - 4 a^{2} d^{2} + \left (2 a^{2} c^{2} e^{2 i e} + 4 i a^{2} c d e^{2 i e} + 6 a^{2} d^{2} e^{2 i e}\right ) e^{2 i f x}}{i c^{5} f + c^{4} d f + 2 i c^{3} d^{2} f + 2 c^{2} d^{3} f + i c d^{4} f + d^{5} f + \left (2 i c^{5} f e^{2 i e} + 6 c^{4} d f e^{2 i e} - 4 i c^{3} d^{2} f e^{2 i e} + 4 c^{2} d^{3} f e^{2 i e} - 6 i c d^{4} f e^{2 i e} - 2 d^{5} f e^{2 i e}\right ) e^{2 i f x} + \left (i c^{5} f e^{4 i e} + 5 c^{4} d f e^{4 i e} - 10 i c^{3} d^{2} f e^{4 i e} - 10 c^{2} d^{3} f e^{4 i e} + 5 i c d^{4} f e^{4 i e} + d^{5} f e^{4 i e}\right ) e^{4 i f x}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**2/(c+d*tan(f*x+e))**3,x)

[Out]

-2*I*a**2*log((-I*c + d)/(-I*c*exp(2*I*e) - d*exp(2*I*e)) + exp(2*I*f*x))/(f*(c - I*d)**3) + (2*a**2*c**2 + 6*
I*a**2*c*d - 4*a**2*d**2 + (2*a**2*c**2*exp(2*I*e) + 4*I*a**2*c*d*exp(2*I*e) + 6*a**2*d**2*exp(2*I*e))*exp(2*I
*f*x))/(I*c**5*f + c**4*d*f + 2*I*c**3*d**2*f + 2*c**2*d**3*f + I*c*d**4*f + d**5*f + (2*I*c**5*f*exp(2*I*e) +
 6*c**4*d*f*exp(2*I*e) - 4*I*c**3*d**2*f*exp(2*I*e) + 4*c**2*d**3*f*exp(2*I*e) - 6*I*c*d**4*f*exp(2*I*e) - 2*d
**5*f*exp(2*I*e))*exp(2*I*f*x) + (I*c**5*f*exp(4*I*e) + 5*c**4*d*f*exp(4*I*e) - 10*I*c**3*d**2*f*exp(4*I*e) -
10*c**2*d**3*f*exp(4*I*e) + 5*I*c*d**4*f*exp(4*I*e) + d**5*f*exp(4*I*e))*exp(4*I*f*x))

________________________________________________________________________________________